<include file="public/header" title="上传支付凭证"   body="g4"/>

<style>
	.sp_idear{
		padding: .85333rem 0;
	}
	.com_igy{
		margin-left: 0!important;
		width: 100%;
	}
	.voucher-box{
		display: flex;
		font-size: .68267rem;
		line-height: 1rem;
	}
	.flex-1{
		flex: 1;
	}
	.flex-2{
		flex: 2;
	}
	.tips-title{
		padding:0 .64rem .64rem .64rem ;
		border-bottom: 1px solid #ccc;
	}
	.act-info,.offline-box{
		padding: .64rem 0;
		border-bottom: 1px solid #ccc;
	}
	.submit-btn{
		display: block;
	    width: 13rem;
	    height: 2rem;
	    line-height: 2rem;
	    margin: 0 auto;
	    font-size: .8rem;
	    text-align: center;
	    background: red;
	    color: white;
	    border-radius: .4rem;
	}
</style>

<form id="add_comment" method="post" action="{:U('Mobile/Cart/add_evidence')}" enctype="multipart/form-data">
<!--顶部-s-->
    <div class="classreturn loginsignup">
        <div class="content">
            <div class="ds-in-bl return">
                <a href="javascript:history.back(-1);"><img src="__STATIC__/images/return.png" alt="返回"></a>
            </div>
            <div class="ds-in-bl search ">
                <span>上传线下支付凭证</span>
            </div>
<!--            <div class="ds-in-bl menu">
                <a class="submit_com" href="javascript:void(0);" onclick="return validate_comment()">提交</a>
            </div>-->
        </div>
    </div>
<!--顶部-e-->
<!--评分-s-->

<div class="sp_idear" >
	
		<div class="tips-title">
			<div class="voucher-box" style="color: red;">
	        		提示：请尽快上传线下支付凭证，后台审核之后，会立即更改您的订单状态。
	        </div>
		</div>
	
	
        <div class="maleri30">
        	
        	
        	<!--账户信息-->
        	<div class="act-info">
        		
	        	<div class="voucher-box">
	        		<div class="flex-1">
	        			账户名称：
	        		</div>
	        		<div class="flex-2" style="color: red;">
	        			{$info.account_name}
	        		</div>
	        		
	        	</div>
	        	
	        	<div class="voucher-box">
	        		<div class="flex-1">
	        			账<span style="opacity: 0;">银行</span>户：
	        		</div>
	        		<div class="flex-2" style="color: red;">
	        			{$info.account_num}
	        		</div>
	        		
	        	</div>
        	
        		
        	</div>
        	
        	<!--账户信息end-->
        	
        	<!--订单信息-->
        	<div class="offline-box">
        		
        		<div class="voucher-box">
	        		<div class="flex-1">
	        			下单时间:
	        		</div>
	        		<div class="flex-2" >
	        			{$order_info.add_time|date="Y-m-d  H:i:s",###}
	        		</div>
	        		
	        	</div>
        		
        		
        		<div class="voucher-box">
        			
		        		<div class="flex-1">
		        			订 单 号:
		        		</div>
		        		<div class="flex-2" >
		        			<a href="{:U('Mobile/User/order_detail',array('id'=>$order_info['order_id']))}">
		        				{$order_info.order_sn}
		        			</a>
		        		</div>
		        	
	        		
	        	</div>
	        	
	        	<div class="voucher-box">
	        		<div class="flex-1">
	        			订单总价:
	        		</div>
	        		<div class="flex-2" style="font-size: .8rem;color: red;">
	        			&yen {$order_info.total_amount}
	        		</div>
	        		
	        	</div>
	        	
	        	
        	</div>
        	
        	<!--订单信息end-->
        	
        	
        	
        	
        	
            <!--<div class="com_igy p">-->
                 <!--<p class="confine-wsp"><font color="red">账户名称：{$info.account_name}</font></p>
                 <p class="confine-wsp"><font color="red">账户：{$info.account_num}</font></p>
                <p class="confine-wsp"><font color="red">提示：请尽快上传线下支付凭证，后台审核之后，会立即更改您的订单状态。</font></p>-->
                <!--<p class="confine-wsp"><a href="{:U('Mobile/User/order_detail',array('id'=>$order_info['order_id']))}">订单号：{$order_info.order_sn}</a></p>
                <p class="confine-wsp  shuxg">{$order_info.add_time|date="Y-m-d  H:i:s",###}</p>
                <p class="confine-wsp  shuxg">订单总价：￥{$order_info.total_amount}</p>-->
           <!-- </div>-->
        </div>
</div>
    <div class="sp_idear" style="padding: 0 .64rem .85333rem; .64rem">
       
         <?php foreach($order_goods as $v){?>
        <div class="voucher-box">
        	<div class="flex-1">
        		<img src="{$v.goods_id|goods_thum_images=100,100}"/>
        	</div>
              <?php 
                     $user = session('user');
                     if($user){
                         if($user['level'] == 2){
                            $price = $v['shop_price1'];
                         }elseif($user['level'] == 3){
                            $price = $v['shop_price2'];
                         }elseif($user['level'] == 4){
                            $price = $v['shop_price3'];
                         }else{
                            $price = $v['shop_price'];
                         }
                     }else{
                        $price = $v['shop_price'];
                     }
                     ?>
            <div class="flex-2">
            	<div class="com_igy p">
	                <p class="confine-wsp">{$v.goods_name}</p>
                        <p class="confine-wsp  shuxg">单价：<span style="color: red;">&yen {$price}</span><span>x{$v['goods_num']}</span></p>
	            </div>
            </div>
            
       </div>
       <?php }?>
    </div>
<!--评分-e-->
<!--评论-s-->
    <div class="customer-messa comm_text_goods">
        <div class="maleri30">
            <textarea class="tapassa1" onkeyup="checkfilltextarea('.tapassa','500')" id="content_13" name="pay_desc" placeholder="有什么要求可以留言呐~">{$evidence.pay_desc}</textarea>
            <span class="xianzd"><em id="zero">200</em>/200</span>
        </div>
    </div>
<!--评论-e-->
<!--上传图片-s-->
    <div class="seravetype">
        <div class="maleri30">
            <?php if($eimg){?>
            <ul id="imglen">
                <?php 
                   $num = count($eimg);
                 
                 ?>
              <?php 
                 for($i=0;$i<5;$i++){
                 if(!empty($eimg[$i])){
                    $link = $eimg[$i];
                 }else{
                    $link = "__STATIC__/images/camera.png";
                 }
                 
              ?>
                <label>
                    <li class="file">
                        <div class="shcph" id="fileList{$i}">
                            <img src="{$link}">
                        </div>
                        <input  type="file" accept="image/*" name="comment_img_file[]"  onchange="handleFiles(this,{$i})" style="display:none">
                    </li>
                </label>
               
             <?php }?>
            </ul>
           <?php }else{?>
           <ul id="imglen">
                <label>
                    <li class="file">
                        <div class="shcph" id="fileList0">
                            <img src="__STATIC__/images/camera.png">
                        </div>
                        <input  type="file" accept="image/*" name="comment_img_file[]"  onchange="handleFiles(this,0)" style="display:none">
                    </li>
                </label>
               <label>
                    <li class="file">
                        <div class="shcph" id="fileList1">
                            <img src="__STATIC__/images/camera.png">
                        </div>
                        <input  type="file" accept="image/*" name="comment_img_file[]"  onchange="handleFiles(this,1)" style="display:none">
                    </li>
                </label>
               <label>
                    <li class="file">
                        <div class="shcph" id="fileList2">
                            <img src="__STATIC__/images/camera.png">
                        </div>
                        <input  type="file" accept="image/*" name="comment_img_file[]"  onchange="handleFiles(this,2)" style="display:none">
                    </li>
                </label>
               <label>
                    <li class="file">
                        <div class="shcph" id="fileList3">
                            <img src="__STATIC__/images/camera.png">
                        </div>
                        <input  type="file" accept="image/*" name="comment_img_file[]"  onchange="handleFiles(this,3)" style="display:none">
                    </li>
                </label>
               <label>
                    <li class="file">
                        <div class="shcph" id="fileList4">
                            <img src="__STATIC__/images/camera.png">
                        </div>
                        <input  type="file" accept="image/*" name="comment_img_file[]"  onchange="handleFiles(this,4)" style="display:none">
                    </li>
                </label>
           </ul>
           
          <?php }?>
        </div>
    </div>
<!--上传图片-e-->

  <!--提交按钮-->
    <a class="submit-btn" href="javascript:void(0);" onclick="return validate_comment()">提交</a>
  
  
<!--服务评价-e-->
    <input type="hidden" name="order_id" value="{$order_info.order_id}">
    <!--<input type="hidden" name="goods_id" value="{$order_goods.goods_id}">-->
</form>
 <include file="public/footer_nav"/>
<script type="text/javascript">
    $(function(){
        //评分
        $('.comment-item-star_wr').click(function(e){
            var obj = $(this);
            obj.find('span').addClass('comment-stars-width5');
            obj.prevAll().find('span').addClass('comment-stars-width5').parent();
            obj.nextAll().find('span').removeClass('comment-stars-width5');
            obj.siblings('input').val(obj.attr('title'));
        })
    })
    function hideUserName(obj){
        if($(obj).hasClass('check_t')){
            $('#hide_username').prop('checked',false);
        }else{
            $('#hide_username').prop('checked',true);
        }

    }

    function validate_comment(){
        var content = $("#content_13").val();
       
        var order_id = $("input[name='order_id']").val();
        var error = [];
        var img_num = 0;
        var AllImgExt=".jpg|.jpeg|.gif|.bmp|.png|";//全部图片格式类型
        //var title = document.getElementById("title").value;
        $(".file input").each(function(index){
            FileExt = this.value.substr(this.value.lastIndexOf(".")).toLowerCase();
            if(this.value!=''){
                img_num++;
                if(AllImgExt.indexOf(FileExt+"|")==-1){
                    error.push("第"+(index+1)+"张图片格式错误");
                }
            }
        });
       
        if(content == ''){
            content = '线下支付凭证上传，请尽快处理';
        }

        if(error.length>0){
            showErrorMsg(error);
            return false;
        }else{
//            $.ajax({
//            type: "POST",
//            url: "{:U('Mobile/Cart/add_evidence')}",
//            data: {
//               pay_desc:content,
//               order_id:order_id,
//            },
//            success: function (data) {
//                //alert(data);return false;
//                data = jQuery.parseJSON(data);
//                if (data.status == 1) {
//                    window.location.href="{:U('Mobile/Cart/pay_offline',array('order_id'=>$order_info['order_id']))}";
//                } else {
//                    showErrorMsg(data.msg);
//                    window.location.reload();
//                }
//            }
//        });

       $('#add_comment').submit();
            return true;
        }
    }

    //显示上传照片
    window.URL = window.URL || window.webkitURL;
    function handleFiles(obj,id) {
        fileList = document.getElementById("fileList"+id);
        var files = obj.files;
        img = new Image();
        if(window.URL){

            img.src = window.URL.createObjectURL(files[0]); //创建一个object URL，并不是你的本地路径
            img.width = 60;
            img.height = 60;
            img.onload = function(e) {
                window.URL.revokeObjectURL(this.src); //图片加载后，释放object URL
            }
            if(fileList.firstElementChild){
                fileList.removeChild(fileList.firstElementChild);
            }
            fileList.appendChild(img);
        }else if(window.FileReader){
            //opera不支持createObjectURL/revokeObjectURL方法。我们用FileReader对象来处理
            var reader = new FileReader();
            reader.readAsDataURL(files[0]);
            reader.onload = function(e){
                img.src = this.result;
                img.width = 60;
                img.height = 60;
                fileList.appendChild(img);
            }
        }else
        {
            //ie
            obj.select();
            obj.blur();
            var nfile = document.selection.createRange().text;
            document.selection.empty();
            img.src = nfile;
            img.width = 60;
            img.height = 60;
            img.onload=function(){

            }
            fileList.appendChild(img);
        }
    }
</script>
</body>
</html>
